var a1 = [];
for (let i = 0; i < 10; i++) {
    a1[i] = function () {
        console.log(i);
    };
}
a1[9](); // 10

for(let i=0;i<3;i++){
    let i = 'abc';
    console.log(i);
}
// var 的情况
console.log(foo); // 输出undefined
var foo = 2;

// let 的情况
console.log(bar); // 报错ReferenceError
let bar = 2;

let a = new Set ([1, 2, 3]);
let b = new Set ([13, 2, 1]);
var filter =[...a].filter(x=>b.has(x));
console.log(filter);

var  map= [...a].map(item=>item*2);
console.log(map);

// 没有函数参数下，立即执行箭头函数
(()=>console.log("hello"))();